<?php
  $CI =& get_instance();
  $CI->load->library('totals');
  $unread_message = $CI->totals->new_messages();
  $fname = $this->session->userdata('e_f_name');
  $user_id = $this->session->userdata('userid');
  $username = $this->session->userdata('username');
  $lname = $this->session->userdata('e_l_name');
  $cp_authlink = $this->authlink->generate_authlink();
  $mname = $this->session->userdata('e_m_name');
  $usertype = $this->session->userdata('userType');
?>

<nav class="top-bar">
  <section class="top-bar-section">
    <!-- Left Nav Section -->
<ul class="title-area">
<!-- Title Area -->
<li class="name">
  <h1>
    <a href="#" data-tooltip class="has-tip" title="<?=$this->school_name;?>">
    <?=$this->school_name;?>
  </a>
  </h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>


<section class="top-bar-section hide-for-small">
  <ul class="left">
    <li class="divider hide-for-medium-down"></li>
    <li class="name hide-for-medium-down">
      <h1><a href="#" data-tooltip class="has-tip" title="User Account Type">(<?=ucwords($usertype);?> Account)</a></h1>
    </li>
    <li class="divider"></li>
    <li class="name">
      <h1><a href="#" data-tooltip class="has-tip" title="Current Academic Year/School Year"><i class="icon-calendar icon-white"></i> SY: <?=$this->schoolyear_date;?></a></h1>
    </li>
    <li class="divider"></li>
    <li class="name">
      <h1><a href="#" data-tooltip class="has-tip" title="Current Grading Period"><?=ucwords($this->gperiods_current);?></a></h1>
    </li>
	<li class="name">
		<h1><a href="<?=site_url('message');?>"><i class="icon-envelope icon-white"></i><span class="message-notifier"><span class="badge badge-important"><?php echo $unread_message; ?></span></span></a></h1>
	</li>
  </ul>
</section>
<?if(strtolower(@$usertype) == 'student'):?>
    <ul class="left show-for-small hide-for-medium-up">
      <li class="divider"></li>
      <li class="has-dropdown"><a href="#">Menu</a>
        <ul class="dropdown">
          <li><a href="#"><?=ucwords(@$fname.' '.@$mname[0].'. '.@$lname);?></a></li>
          <li><a href="<?php echo site_url();?>"><i class='icon-white icon-home'></i> Home</a></li>
          <li><a href="<?php echo site_url('student/change_password/'.$user_id.'/'.$cp_authlink);?>" class="confirm" title="Are you sure you want to change your login password? "><i class='icon-white icon-edit'></i> Change Password</a></li>
          <li><a href="#" data-tooltip class="has-tip" title="User Account Type">(<?=ucwords($usertype);?> Account)</a></li>
          <li class="divider"></li>
        </ul>
      </li>
      <li class="divider"></li>
    </ul>
    <!-- Right Nav Section -->
    <ul class="right hide-for-small">
      <li class="has-dropdown"><a href="#"><a href="#"><?=ucwords(@$fname.' '.@$mname[0].'. '.@$lname);?></a>
        <ul class="dropdown left">
          <li class="left"><a href="<?php echo site_url();?>"><i class='icon-white icon-home'></i> Home</a></li>
          <li class="left"><a href="<?php echo site_url('student/change_password/'.__link($user_id));?>" class="confirm" title="Are you sure you want to change your login password? "><i class='icon-white icon-edit'></i> Change Password</a></li>
          <li class="divider"></li>
          <li class="left"><a href="<?php echo site_url('auth/logout/student');?>" class="confirm" title="Are you sure you want to logout?"><i class='icon-white icon-off'></i> Logout </a></li>
        </ul>
      </li>
    </ul>
<?elseif(strtolower(@$usertype) == 'guardian'):?>
    <ul class="left show-for-small hide-for-medium-up">
      <li class="divider"></li>
      <li class="has-dropdown"><a href="#">Menu</a>
        <ul class="dropdown">
          <li><a href="#"><?=ucwords(@$username);?></a></li>
          <li><a href="<?php echo site_url();?>"><i class='icon-white icon-home'></i> Home</a></li>
          <li><a href="<?php echo site_url('guardian/change_password/'.__link($user_id));?>" class="confirm" title="Are you sure you want to change your login password? "><i class='icon-white icon-edit'></i> Change Password</a></li>
          <li><a href="#" data-tooltip class="has-tip" title="User Account Type">(<?=ucwords($usertype);?> Account)</a></li>
          <li class="divider"></li>
        </ul>
      </li>
      <li class="divider"></li>
    </ul>
    <!-- Right Nav Section -->
    <ul class="right hide-for-small">
      <li class="has-dropdown"><a href="#"><?=ucwords(@$username);?></a>
        <ul class="dropdown left">
          <li class="left"><a href="<?php echo site_url();?>"><i class='icon-white icon-home'></i> Home</a></li>
          <li class="left"><a href="<?php echo site_url('guardian/change_password/'.__link($user_id));?>" title="Are you sure you want to change your login password? "><i class='icon-white icon-cog'></i>Settings</a></li>
          <li class="divider"></li>
          <li class="left"><a href="<?php echo site_url('auth/logout/parent');?>" class="confirm" title="Are you sure you want to log out?"><i class='icon-white icon-off'></i> Logout </a></li>
        </ul>
      </li>
    </ul>
<?endif;?>    
  </section>
</nav>